{include file="$MODULES_DIR/backoffice/templates/block/modal/ModalTitle.html" title=$fileName}
<div id="modalContent" class="withoutFooter" style="width: {$dimensions.0+80}px">
<div id="modalFileName">{$fileName}</div>
<div id="modalActionLine">
    {hasRight rule=medias_Delete}
    {hasDocRight document=$media module="medias" rule="delete"}
    <span style="width: 20px; height: 20px; ">
        <a href="?module=backoffice&action=AjaxContext&href={url route='deleteGeneric' moduleName=$media->getDocumentModuleName() docId=$media->getUniqueId() docLang=$media->getLang()}" class="nyroModal openModal itemButton itemDeleteButton"></a>
    </span>
    {/hasDocRight}
    {/hasRight}
    
    {hasRight rule=medias_Edit}
    {hasDocRight document=$media module="medias" rule="edit"}
    <span style="width: 20px; height: 20px; ">
        <a href="?module=backoffice&action=AjaxContext&href={$media->getEditUrl($media->getFolderId())}" class="nyroModal openModal itemButton itemEditButton"></a>
    </span>
    {/hasDocRight}
    {/hasRight}
</div>
<div style="display:block;">
    <table width="100%" style="height:{$dimensions.1}px;">
        <tr>
            {if $previousImage != null}<td style="width: 20px; vertical-align: middle; padding: 5px;"><a href="?module=backoffice&action=AjaxContext&href={url route='mediaViewImage' docId=$previousImage->getUniqueId() docLang=$previousImage->getLang() width='default' height='default'}" class="nyroModal openModal arrowButton arrowButtonLeft"></a></td>{else}<td style="width: 20px;">&nbsp;</td>{/if}
            <td style="width:{$dimensions.0+20}px;text-align:center;vertical-align: middle;padding: 9px;"><a href="?module=medias&action=AjaxDownloadFile&docId={$media->getUniqueId()}&docLang={$media->getLang()}" title="{t}Click to download file{/t}"><img src="{$image}" /></a></td>
            {if $nextImage != null}<td style="width: 20px; vertical-align: middle; padding: 5px;"><a href="?module=backoffice&action=AjaxContext&href={url route='mediaViewImage' docId=$nextImage->getUniqueId() docLang=$nextImage->getLang() width='default' height='default'}" class="nyroModal openModal arrowButton arrowButtonRight"></a></td>{else}<td style="width: 20px;">&nbsp;</td>{/if}
        </tr>
        {if isset($originalImage)}
        <tr>
            <td></td>
            <td style="text-align: center;padding: 5px;">( {icon name="help.png"} {t}Image preview{/t}, <a href="{$originalImage}" target="_blank">{t}click here{/t}</a> {t}to view it in original dimensions{/t} )</td>
            <td></td>
        </tr>
        {/if}
    </table>
</div>

{if count($images) > 1}
<div>
    <table style="width: 100%" class="tabMedia">
        <tr class="tabMediaHeader"><td colspan="4" style="text-align: center; vertical-align:middle;">{t}OTHER DIMENSIONS{/t}</td></tr>
    {foreach from=$images item=image}
        <tr>
            <td style="width: 24px;">
                <span class="listButtons">
                    <a href="?module=backoffice&action=AjaxContext&href={if $image.original}{url route='mediaViewImage' docId=$media->getUniqueId() docLang=$media->getLang() width='default' height='default'}{else}{url route='mediaViewImage' docId=$media->getUniqueId() docLang=$media->getLang() width=$image.width height=$image.height}{/if}" class="nyroModal openModal itemButton itemViewButton defaultAction"></a>
                </span>
            </td>
            <td>{$image.width} x {$image.height} pixels{if $image.original} (image originale){/if}</td>
            <td style="text-align: right">{$image.fileSize}&nbsp;</td>
            <td></td>
        </tr>
    {/foreach}
    </table>
</div>
{/if}

<script type="text/javascript">
    {literal}
    $(".openModal").nyroModal({
        minHeight: null,
        minWidth: null,
        modal: true,
        bgColor: '#D4D0C8'
        
    });
    $(document).ready(function() {
        $('.tabMedia tbody tr').hover(function(){
            $(this).find('.listButtons').css('visibility', 'visible');
            link = $(this).find('.defaultAction').attr('href');
            if(link != null && link != '') $(this).find('td').css('cursor', 'pointer');


            $(this).children('td').each(function(){
                if(!$(this).children('span').hasClass('listButtons') && $(this).children('input').attr('type')!='checkbox' && !$(this).children('a').hasClass('publicationSwitchButton'))
                {
                    $(this).unbind('click');
                        $(this).click(function(){
                                    if(link != null && link != '')
                                    {
                                        if($(this).parent().find('.defaultAction').hasClass('openNewWindow'))
                                        {
                                            slideMenuToUp(getActiveTab(getHash(link)));
                                        }
                                        else
                                        {
                                            showModal('?module=backoffice&action=AjaxContext&href='+getHash(link));
                                        }
                                    }
                                });
                }
            });
        }, function(){
            $(this).children('td').children('.listButtons').css('visibility', 'hidden');
        });
    })


    {/literal}
</script>

</div>
{include file="$MODULES_DIR/backoffice/templates/block/modal/ModalFooter.html" noButton="true"}